package com.ruihu.admin.constant;

import java.util.Arrays;
import java.util.Optional;

public enum SystemStatusEnum {

    /**
     * dev
     */
    YES(1, "是"),

    /**
     * sit
     */
    NO(0, "否");

    private Integer code;

    private String message;


    SystemStatusEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public static SystemStatusEnum selectByValue(Integer value) {
        Optional<SystemStatusEnum> first = Arrays.stream(SystemStatusEnum.values()).filter(e -> e.getCode().equals(value)).findFirst();
        return !first.isPresent() ? null : first.get();
    }
}
